#####################################################
# R Replication files                               #
# Coalition Government Formation and Policy Payoffs #
# Date: March 26, 2025                              #
# By: Simon Otjes                                   #
#####################################################

# Hello! This replication file comes in two parts
# Part 1: Read in data and packages
# Part 2: Figure 1 and Table A4
# Part 3: Table 1, Table A3
# Part 4: Figure 2 and 3

#####################################
# Part 1: Read in data and packages #
#####################################

# Please replace all paths (i.e., ~/Dropbox/Otjes Willumsen/Price of coalition government/" so that they match your computer setup)

# data sets
gamson1<-read.csv("~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/inputs/data - Figure 1.csv",header=TRUE)
maindata<-read.csv("~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/inputs/main data.csv",header=TRUE)

# packages
library(effects)
library(texreg)

# function 
overview<-function(vector) {

	return<-c(round(mean(vector,na.rm=TRUE),2),
	round(median(vector,na.rm=TRUE),2),
	round(sd(vector,na.rm=TRUE),2),
	round(min(vector,na.rm=TRUE),2),
	round(max(vector,na.rm=TRUE),2),
	length(vector)-sum(is.na(vector)))
	return(return)
}

#################################
# Part 2: Figure 1 and Table A4 #
################################# 

# Step 1: prepare data

# remove parties without seats (i.e. independent ministers)

gamson<-gamson1[gamson1[,5]>0,]

# generate unique list of cabinets
UG<-unique(gamson$Cabinet)

# generate a matrix to save data
save<-as.data.frame(matrix(nrow=nrow(gamson),ncol=3))
colnames(save)<-c("minister","cabinet","parliament")

# calculate share of ministers, share of cabinet and share of seats

for (i in 1:length(UG)){
	
	subset<-gamson[UG[i]==gamson$Cabinet,]
	
	save[UG[i]==gamson$Cabinet,1]<-subset$Minister/sum(subset$Minister)
	save[UG[i]==gamson$Cabinet,2]<-rowSums(subset[,3:4])/sum(subset[,3:4])
	save[UG[i]==gamson$Cabinet,3]<-subset$Seats/sum(subset$Seats)
	
}

# Step 3: analyses and figures

# run regressions

model1<-lm(minister~parliament,data=save)
model2<-lm(cabinet~parliament,data=save)

# make figures 

matrix1<-(allEffects(model1,xlevels=list(parliament=c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1))))
matrix2<-(allEffects(model2,xlevels=list(parliament=c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1))))

# Figure 1

tiff("~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Figure 1.tiff", units="cm", width=30, height=15, res=300)

par( mfrow = c( 1, 2 ) )

plot(y=save$minister,x=save$parliament,col="grey",xlim=c(0,0.7),ylim=c(0,0.7),xlab="Share of Seats",ylab="Share of Ministers",main="Dutch ministerial appointments
1918-2022")
lines(x=c(0:10)/10,y=as.vector(summary(matrix1[[1]])[[3]]))
lines(x=c(0:10)/10,y=as.vector(summary(matrix1[[1]])[[5]]),lty=2)
lines(x=c(0:10)/10,y=as.vector(summary(matrix1[[1]])[[7]]),lty=2)

lines(lty=3,x=c(0:9)/9,y=c(0:9)/9)

plot(y=save$cabinet,x=save$parliament,col="grey",xlim=c(0,0.7),ylim=c(0,0.7),xlab="Share of Seats",ylab="Share of Ministers incl. junior ministers",main="Dutch ministerial appointments
1948-2022 incl. junior ministers")
lines(x=c(0:10)/10,y=as.vector(summary(matrix2[[1]])[[3]]))
lines(x=c(0:10)/10,y=as.vector(summary(matrix2[[1]])[[5]]),lty=2)
lines(x=c(0:10)/10,y=as.vector(summary(matrix2[[1]])[[7]]),lty=2)

lines(lty=3,x=c(0:9)/9,y=c(0:9)/9)
dev.off()

# save regressions

htmlreg<-htmlreg(list(model1,model2))

write(htmlreg,"~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Table A4.html")

#############################
# Part 2: Table 1, Table A3 #
#############################

# Table 1

Table<-matrix(nrow=16,ncol=9,data="")
Table[c(1,4,7,9,13),1]<-c(2007,2010,2012,2017,2022)
Table[c(1,4,7,9,13),2]<-gamson[c(16,11,9,5,1),1]
Table[c(1,4,7,9,13),3]<-as.Date(c("2007-2-22","2010-10-14","2012-11-5","2017-10-26","2022-1-10"))-as.Date(c("2006-11-22","2010-6-9","2012-9-12","2017-3-15","2021-3-17"))
Table[,4]<-c(gamson[c(16:18,11,13,12,9,10,5,6,7,8,1,3,2,4),2])

seats<-gamson[c(c(16:18),c(11,13,12),c(9,10),c(5,6,7,8),c(1,3,2,4)),5]

Table[,5]<-round(seats/c(rep(sum(seats[1:3]),3),rep(sum(seats[4:6]),3),rep(sum(seats[7:8]),2),rep(sum(seats[9:12]),4),rep(sum(seats[13:16]),4))*100,0)

mini<-gamson[c(c(16:18),c(11,13,12),c(9,10),c(5,6,7,8),c(1,3,2,4)),3]

Table[,6]<-round(mini/c(rep(sum(mini[1:3]),3),rep(sum(mini[4:6]),3),rep(sum(mini[7:8]),2),rep(sum(mini[9:12]),4),rep(sum(mini[13:16]),4))*100,0)

mnss<-rowSums(gamson[c(c(16:18),c(11,13,12),c(9,10),c(5,6,7,8),c(1,3,2,4)),3:4])

Table[,7]<-round(mnss/c(rep(sum(mnss[1:3]),3),rep(sum(mnss[4:6]),3),rep(sum(mnss[7:8]),2),rep(sum(mnss[9:12]),4),rep(sum(mnss[13:16]),4))*100,0)

Table[1, 8]<-round(100*mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2007)],na.rm=TRUE),0)
Table[2, 8]<-round(100*mean(maindata$binary[(maindata$party=="PvdA")&(maindata$year==2007)],na.rm=TRUE),0)
Table[3, 8]<-round(100*mean(maindata$binary[(maindata$party=="CU")  &(maindata$year==2007)],na.rm=TRUE),0)
Table[4, 8]<-round(100*mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2010)],na.rm=TRUE),0)
Table[5, 8]<-round(100*mean(maindata$binary[(maindata$party=="PVV") &(maindata$year==2010)],na.rm=TRUE),0)
Table[6, 8]<-round(100*mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2010)],na.rm=TRUE),0)
Table[7, 8]<-round(100*mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2012)],na.rm=TRUE),0)
Table[8, 8]<-round(100*mean(maindata$binary[(maindata$party=="PvdA")&(maindata$year==2012)],na.rm=TRUE),0)
Table[9, 8]<-round(100*mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2017)],na.rm=TRUE),0)
Table[10,8]<-round(100*mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2017)],na.rm=TRUE),0)
Table[11,8]<-round(100*mean(maindata$binary[(maindata$party=="D66") &(maindata$year==2017)],na.rm=TRUE),0)
Table[12,8]<-round(100*mean(maindata$binary[(maindata$party=="CU")  &(maindata$year==2017)],na.rm=TRUE),0)
Table[13,8]<-round(100*mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2022)],na.rm=TRUE),0)
Table[14,8]<-round(100*mean(maindata$binary[(maindata$party=="D66") &(maindata$year==2022)],na.rm=TRUE),0)
Table[15,8]<-round(100*mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2022)],na.rm=TRUE),0)
Table[16,8]<-round(100*mean(maindata$binary[(maindata$party=="CU")  &(maindata$year==2022)],na.rm=TRUE),0)

Table[1, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2007)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2007)],na.rm=TRUE),0)
Table[2, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="PvdA")&(maindata$year==2007)],x=maindata$binary[(maindata$party=="PvdA")&(maindata$year==2007)],na.rm=TRUE),0)
Table[3, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CU")  &(maindata$year==2007)],x=maindata$binary[(maindata$party=="CU")  &(maindata$year==2007)],na.rm=TRUE),0)
Table[4, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2010)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2010)],na.rm=TRUE),0)
Table[5, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="PVV") &(maindata$year==2010)],x=maindata$binary[(maindata$party=="PVV") &(maindata$year==2010)],na.rm=TRUE),0)
Table[6, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2010)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2010)],na.rm=TRUE),0)
Table[7, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2012)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2012)],na.rm=TRUE),0)
Table[8, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="PvdA")&(maindata$year==2012)],x=maindata$binary[(maindata$party=="PvdA")&(maindata$year==2012)],na.rm=TRUE),0)
Table[9, 9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2017)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2017)],na.rm=TRUE),0)
Table[10,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2017)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2017)],na.rm=TRUE),0)
Table[11,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="D66") &(maindata$year==2017)],x=maindata$binary[(maindata$party=="D66") &(maindata$year==2017)],na.rm=TRUE),0)
Table[12,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CU")  &(maindata$year==2017)],x=maindata$binary[(maindata$party=="CU")  &(maindata$year==2017)],na.rm=TRUE),0)
Table[13,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2022)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2022)],na.rm=TRUE),0)
Table[14,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="D66") &(maindata$year==2022)],x=maindata$binary[(maindata$party=="D66") &(maindata$year==2022)],na.rm=TRUE),0)
Table[15,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2022)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2022)],na.rm=TRUE),0)
Table[16,9]<-round(100*weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CU")  &(maindata$year==2022)],x=maindata$binary[(maindata$party=="CU")  &(maindata$year==2022)],na.rm=TRUE),0)

colnames(Table)<-c("Year","Cabinet","Formation","Parties","Seats","Ministers","InclJun","Share","Weight")

write.csv(Table,"~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Table 1.csv")


# "The correlation between seats and ministries held by governing parties is 0.79 (full ministers only; 0.78 when including junior ministers). "
seatU<-seats/c(rep(sum(seats[1:3]),3),rep(sum(seats[4:6]),3),rep(sum(seats[7:8]),2),rep(sum(seats[9:12]),4),rep(sum(seats[13:16]),4))
miniU<-mini/c(rep(sum(mini[1:3]),3),rep(sum(mini[4:6]),3),rep(sum(mini[7:8]),2),rep(sum(mini[9:12]),4),rep(sum(mini[13:16]),4))
mnssU<-mnss/c(rep(sum(mnss[1:3]),3),rep(sum(mnss[4:6]),3),rep(sum(mnss[7:8]),2),rep(sum(mnss[9:12]),4),rep(sum(mnss[13:16]),4))

cor.test(seatU,miniU)
cor.test(seatU,mnssU)

# The share of proposals included does not conform to this pattern: the correlation with seat share is 0.27 for the share of proposals and 0.22 for the weighted share of proposals for cabinet parties

binaU<-rep(NA,16)

binaU[1]<-mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2007)],na.rm=TRUE)
binaU[2]<-mean(maindata$binary[(maindata$party=="PvdA")&(maindata$year==2007)],na.rm=TRUE)
binaU[3]<-mean(maindata$binary[(maindata$party=="CU")  &(maindata$year==2007)],na.rm=TRUE)
binaU[4]<-mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2010)],na.rm=TRUE)
binaU[5]<-mean(maindata$binary[(maindata$party=="PVV") &(maindata$year==2010)],na.rm=TRUE)
binaU[6]<-mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2010)],na.rm=TRUE)
binaU[7]<-mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2012)],na.rm=TRUE)
binaU[8]<-mean(maindata$binary[(maindata$party=="PvdA")&(maindata$year==2012)],na.rm=TRUE)
binaU[9]<-mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2017)],na.rm=TRUE)
binaU[10]<-mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2017)],na.rm=TRUE)
binaU[11]<-mean(maindata$binary[(maindata$party=="D66") &(maindata$year==2017)],na.rm=TRUE)
binaU[12]<-mean(maindata$binary[(maindata$party=="CU")  &(maindata$year==2017)],na.rm=TRUE)
binaU[13]<-mean(maindata$binary[(maindata$party=="VVD") &(maindata$year==2022)],na.rm=TRUE)
binaU[14]<-mean(maindata$binary[(maindata$party=="D66") &(maindata$year==2022)],na.rm=TRUE)
binaU[15]<-mean(maindata$binary[(maindata$party=="CDA") &(maindata$year==2022)],na.rm=TRUE)
binaU[16]<-mean(maindata$binary[(maindata$party=="CU")  &(maindata$year==2022)],na.rm=TRUE)

winaU<-rep(NA,16)

winaU[1]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2007)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2007)],na.rm=TRUE)
winaU[2]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="PvdA")&(maindata$year==2007)],x=maindata$binary[(maindata$party=="PvdA")&(maindata$year==2007)],na.rm=TRUE)
winaU[3]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CU")  &(maindata$year==2007)],x=maindata$binary[(maindata$party=="CU")  &(maindata$year==2007)],na.rm=TRUE)
winaU[4]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2010)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2010)],na.rm=TRUE)
winaU[5]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="PVV") &(maindata$year==2010)],x=maindata$binary[(maindata$party=="PVV") &(maindata$year==2010)],na.rm=TRUE)
winaU[6]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2010)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2010)],na.rm=TRUE)
winaU[7]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2012)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2012)],na.rm=TRUE)
winaU[8]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="PvdA")&(maindata$year==2012)],x=maindata$binary[(maindata$party=="PvdA")&(maindata$year==2012)],na.rm=TRUE)
winaU[9]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2017)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2017)],na.rm=TRUE)
winaU[10]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2017)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2017)],na.rm=TRUE)
winaU[11]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="D66") &(maindata$year==2017)],x=maindata$binary[(maindata$party=="D66") &(maindata$year==2017)],na.rm=TRUE)
winaU[12]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CU")  &(maindata$year==2017)],x=maindata$binary[(maindata$party=="CU")  &(maindata$year==2017)],na.rm=TRUE)
winaU[13]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="VVD") &(maindata$year==2022)],x=maindata$binary[(maindata$party=="VVD") &(maindata$year==2022)],na.rm=TRUE)
winaU[14]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="D66") &(maindata$year==2022)],x=maindata$binary[(maindata$party=="D66") &(maindata$year==2022)],na.rm=TRUE)
winaU[15]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CDA") &(maindata$year==2022)],x=maindata$binary[(maindata$party=="CDA") &(maindata$year==2022)],na.rm=TRUE)
winaU[16]<-weighted.mean(w=maindata$absoluteproposal[(maindata$party=="CU")  &(maindata$year==2022)],x=maindata$binary[(maindata$party=="CU")  &(maindata$year==2022)],na.rm=TRUE)

cor.test(seatU,binaU)
cor.test(seatU,winaU)

# "The correlations are 0.91 (full ministers), 0.90 (full and junior ministers), 0.31 (proposals) and 0.34 (weighted share of proposals) when excluding the PVV which as support party did not supply ministers."

seatV<-seatU
seatV[5]<-NA

cor.test(seatV,miniU)
cor.test(seatV,mnssU)
cor.test(seatV,binaU)
cor.test(seatV,winaU)



# Table A2

TableA2<-matrix(nrow=16,ncol=12,data="")
TableA2[c(1,4,7,9,13),1]<-c(2007,2010,2012,2017,2022)
TableA2[,2]<-c(gamson[c(16:18,11,13,12,9,10,5,6,7,8,1,3,2,4),2])
xtabs<-xtabs(~maindata$party+maindata$year)
TableA2[,3]<-c(xtabs[c(1,4,2),1],xtabs[c(6,5,1),2],xtabs[c(6,4),3],xtabs[c(6,1,3,2),4],xtabs[c(6,3,1,2),5])
xtabs1<-round(xtabs(maindata$absoluteproposal~maindata$party+maindata$year),2)
TableA2[,4]<-c(xtabs1[c(1,4,2),1],xtabs1[c(6,5,1),2],xtabs1[c(6,4),3],xtabs1[c(6,1,3,2),4],xtabs1[c(6,3,1,2),5])
TableA2[,5]<-round(as.numeric(TableA2[,4])/as.numeric(TableA2[,3],2),2)

Year<-c(2007,2007,2007,2010,2010,2010,2012,2012,2017,2017,2017,2017,2022,2022,2022,2022)

for (i in 1:16){
	TableA2[i,6]<-round(sd(maindata$absoluteproposal[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)
	TableA2[i,7]<-round(min(maindata$absoluteproposal[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)
	TableA2[i,8]<-round(max(maindata$absoluteproposal[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)	
	TableA2[i,9]<-round(mean((maindata$sparties==0)[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)
	TableA2[i,10]<-round(mean((maindata$sparties==1)[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)	
	TableA2[i,11]<-round(mean(maindata$sparties[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)	
	TableA2[i,12]<-round(sd(maindata$sparties[(maindata$party==TableA2[i,2])&(maindata$year==Year[i])],na.rm=TRUE),2)		
}

write.csv(TableA2,"~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Table A2.csv")

# Table A3

TableA3<-matrix(nrow=14,ncol=6)

TableA3[ 1,]<-overview(maindata$binary)
TableA3[ 2,]<-overview(maindata$ratio)
TableA3[ 3,]<-overview(maindata$category)
TableA3[ 4,]<-overview(maindata$direction)
TableA3[ 5,]<-overview(maindata$absoluteproposal)
TableA3[ 6,]<-overview(maindata$share)
TableA3[ 7,]<-overview(maindata$cap.percent)
TableA3[ 8,]<-overview(maindata$cap.relative)
TableA3[ 9,]<-overview(maindata$sparties)
TableA3[10,]<-overview(maindata$coashare)
TableA3[11,]<-overview(maindata$plenshare)
TableA3[12,]<-overview(maindata$sparties == 1)
TableA3[13,]<-overview(maindata$ministerparty)
TableA3[14,]<-overview(maindata$ssparty)

write.csv(TableA3,"~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Table A3.csv")

##########################
# Part 3: Figure 2 and 3 #
##########################

data<-read.csv("~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Figure 2 and 3.csv")


tiff("~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Figure 2.tiff", units="cm", width=15, height=15, res=300)

plot(x=c(0:10)/10,y=data$SPartiesES,col=0,ylim=c(0,1),main="Share of Supporting Parties and Probability of Inclusion",ylab="Probability of Inclusion",xlab="Share of Supporting Parties")

lines(x=c(0:10)/10,y=data$SPartiesES)
lines(x=c(0:10)/10,y=data$SPartiesLO,lty=2)
lines(x=c(0:10)/10,y=data$SPartiesHI,lty=2)
dev.off()

tiff("~/Dropbox/Otjes Willumsen/Price of coalition government/replication files/outputs/Figure 3.tiff", units="cm", width=30, height=15, res=300)

par( mfrow = c( 1, 2 ) )

plot(x=c(0:10)/10,y=data$ShareES,col=0,ylim=c(0,1),main="Share of Seats and Probability of Inclusion",ylab="Probability of Inclusion",xlab="Share of Seats")

lines(x=c(0:10)/10,y=data$ShareES)
lines(x=c(0:10)/10,y=data$ShareLO,lty=2)
lines(x=c(0:10)/10,y=data$ShareHI,lty=2)


plot(x=c(0:10)/10,y=data$SPartiesES,col=0,ylim=c(0,1),main="Relative Attention and Probability of Inclusion",ylab="Probability of Inclusion",xlab="Relative Attention")

lines(x=c(0:10)/10,y=data$CAPRelativeES)
lines(x=c(0:10)/10,y=data$CAPRelativeLO,lty=2)
lines(x=c(0:10)/10,y=data$CAPRelativeHI,lty=2)

dev.off()